{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "# 制作全景视频发到您的空间"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "<font style=\"font-size:20px;text-align:left;\" color=\"red\">\n",
    "    建议先观看：《制作全景图片》 和 《音频视频互转》\n",
    "</font>\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "## 1、准备一张全景图片"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "from IPython.display import Image, Audio\n",
    "from av_utils import show_img\n",
    "import os\n",
    "\n",
    "pan_image_file = \"images/风景全景图.jpg\"\n",
    "\n",
    "print(\"全景图片路径：\", os.path.abspath(pan_image_file))\n",
    "# 全景图片\n",
    "show_img(pan_image_file)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "<font style=\"font-size:20px;text-align:left\" color=\"red\">\n",
    "    1.1 百度搜索“图片”关键字“全景图片”，选择“特大尺寸”则能得到高清图片\n",
    "</font>\n",
    "\n",
    "<img src=\"images/baidu_pan.jpg\"  align=\"left\"/>\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<font style=\"font-size:20px;text-align:left\" color=\"red\">\n",
    "    1.2 我们提供的网盘有高清全景图片(扫描二维码)\n",
    "</font>\n",
    "\n",
    "<img src=\"images/网盘二维码.jpg\" style=\"width:80%\" align=\"left\"/>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2、准备一首背景音乐"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "mp3_file = \"audio/雅致茶音.mp3\"  # 原始音频文件\n",
    "\n",
    "print(\"背景音乐文件：\", os.path.abspath(mp3_file))\n",
    "\n",
    "# 背景音乐\n",
    "Audio(mp3_file, autoplay=True)   "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "## 3、制作全景视频"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "from IPython.display import Video\n",
    "from av_utils import ia_to_mp4\n",
    "\n",
    "# 输出全景视频文件路径\n",
    "output_file =  'output/风景全景视频.mp4'\n",
    "\n",
    "print(\"全景图片路径：\", os.path.abspath(pan_image_file))\n",
    "print(\"背景音乐文件：\", os.path.abspath(mp3_file))\n",
    "print(\"     ↓↓↓\")\n",
    "print(\"全景视频路径：\", os.path.abspath(output_file))\n",
    "\n",
    "# 制作全景视频\n",
    "ia_to_mp4(pan_image_file, mp3_file, output_file)\n",
    "\n",
    "Video(output_file, width=320, height=184, embed=True)   "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "## 4、用支持全景的软件查看\n",
    "\n",
    "<font style=\"font-size:20px;\">比如：PotPlayer、utovr、GoPro VR Player、Insta360 Player</font>\n",
    "<br><br>\n",
    "<font style=\"font-size:20px;\" color=\"red\">请搜索关键字“cubemap 全景”，了解更多\n",
    "    </font>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "source": [
    "## 5、上传到您的视频空间\n",
    "\n",
    "<font style=\"font-size:20px;\">支持 VR 360 短视频平台有：抖音、快手、B站、720云等等</font>\n",
    "<div style=\"text-align:left;background-color:#eee;\">\n",
    "<table>\n",
    "    <tr><td style=\"background-color:white;\"><img src=\"images/douyin_logo.svg\"></td>\n",
    "        <td style=\"background-color:black;\"><img src=\"images/kuaishou_logo.svg\"></td>\n",
    "        <td style=\"background-color:white;\"><img src=\"images/bilili_logo.svg\"></td>\n",
    "        <td style=\"background-color:white;\"><img src=\"images/720yun.png\"></td>        \n",
    "    </tr>\n",
    "</table>\n",
    "    </div>"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
